<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>商之联-商家后台管理系统</title>
  <meta name="description" content="这是一个 table 页面">
  <meta name="keywords" content="table">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="{:C('SHOP_HOME_IMG')}favicon.png"> <link rel="apple-touch-icon-precomposed" href="{:C('SHOP_HOME_IMG')}app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="{:C('SHOP_HOME_CSS')}amazeui.min.css"/>
  <link rel="stylesheet" href="{:C('SHOP_HOME_CSS')}admin.css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
<!-- header start-->

<include file="Public:header"/>

<!-- header end-->

<div class="am-cf admin-main">
 <!-- sidebar start -->
   <include file="Public:menu"/>
  <!-- sidebar end -->
  
  <!-- content start -->
  <div class="admin-content">

    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">订单管理</strong> / <small>订单列表</small></div>
    </div>
     <div class="am-g" style="float:left;width:200px;margin-left:270px">
      <div class="am-u-md-3 am-cf" >
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
           
          <p>  开始时间： <input class="laydate-icon" id="start" style="width:200px; " type="text" /> </p>
       
    
               
          </div>
        </div>
      </div>
    </div>

    <div class="am-g" style="float:left ;width:200px;margin-left:20px;">
      <div class="am-u-md-3 am-cf" >
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
           
        
           <p>  结束时间： <input class="laydate-icon" id="end" style="width:200px;" type="text"/></p> 
           
    
               
          </div>
        </div>
      </div>
    </div>

      <div class="am-g" style="marign-left:20px;">
      <div class="am-u-md-3 am-cf" >
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
           
        
            <button class="am-btn am-btn-default searOrder" type="button" style="color:#0EABE5">搜索</button>
    
               
          </div>
        </div>
      </div>
    </div>
    <div class="am-g">
      <div class="am-u-sm-12">
        <form class="am-form">
          <table class="am-table am-table-striped am-table-hover table-main ordertable">
            <thead>
              <tr>
                <th class="table-check"><input type="checkbox"></th>
                <th class="table-title">订单号</th>
                <th class="table-title">创建时间</th>
                <th class="table-title">支付类型</th>
                <th class="table-title">订单数量</th>
                <th class="table-title">订单金额</th>
                <th class="table-date">订单名称</th>
                <th class="table-date">订单状态</th>
                <th class="table-set">操作</th>
              </tr>
          </thead>
          <tbody>
            <foreach name="orders" item='order'>
            <tr>
              <td><input type="checkbox"></td>
              <td>{$order['order_sn']}</td>
              <td>{$order['create_time'] |date="Y-m-d ",###}</td>
               <td>
               	<switch name="order.pay_type">
               		<case value="0">线上支付</case>
               		<case value="1">线下支付</case>
               	</switch>
               </td>
               <td>{$order['number']}</td>         
              <td>{$order['order_amount']}</td> 
              <td>{$order['itemname']} </td>
              <td>
                 <switch name="order.new_orderstatus">
                   <case value='3'> 已付款 </case>
                  <case value='0'>  未确认 </case>
                  <case value='2'>  取消   </case>
                  <case value='1'>  确认   </case>
                  <case value='6'>  配货中 </case>
                  <case value='8'>  已发货 </case>
                  <case value='9'>  已收货 </case>
                  <default />未确认
                </switch>
              </td>
              <td>
                <div class="am-btn-toolbar">
                  <div class="am-btn-group am-btn-group-xs">
	                    <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
	                    <span class="am-icon-pencil-square-o">
	                    <a href="{:U('Order/getOrder',array('orderid'=>$order['orderid']))}">查看详情</a> 
	                    </span> 
	                    </button>
                  </div>
                </div>
              </td>
            </tr>
            </foreach>
          </tbody>
        </table>
          <div class="am-cf orderpage">
  共 {$pagearr['count']}条记录
  
<div class="am-fr">
    <ul class="am-pagination">
      <li><a href="{:U('Order/index',array('page'=>$pagearr['prevpage']))}">«</a></li>
       <?php $k=0; ?>
      <for start="$pagearr['page']" end="$pagearr['pagetotal']+1"  name='i' step="1">
         <if condition="$k lt 6">
           <li <if condition="$i eq $pagearr['page']"> class="am-active" </if>  > <a href="{:U('Order/index',array('page'=>$i))}">{$i}</a></li>
         </if>
       <?php $k+=1;  ?>
      </for>
      
      <li><a href="{:U('Order/index',array('page'=>$pagearr['nextpage']))}">»</a></li>
    </ul>
  </div>

</div>
        </form>
      </div>

    </div>
  </div>
  <!-- content end -->
</div>
<footer>
  <hr>
  <p class="am-padding-left">© 2014 商之联.</p>
</footer>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}polyfill/rem.min.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}polyfill/respond.min.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}amazeui.legacy.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="{:C('SHOP_HOME_JS')}jquery.min.js"></script>
<script src="{:C('SHOP_HOME_JS')}amazeui.min.js"></script>
<!--<![endif]-->
<script src="{:C('SHOP_HOME_JS')}app.js"></script>
<script src="{:C('SUPPLIER_ADMIN_JS')}laydate/laydate.js"></script>
<script type="text/javascript">
  //日期插件

var start = {
    elem: '#start',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: '1999-06-16 23:59:59', //设定最小日期为当前日期
    max: '2099-06-16 23:59:59', //最大日期
    istime: true,
    istoday: false,
    choose: function(datas){
         end.min = datas; //开始日选好后，重置结束日的最小日期
         end.start = datas //将结束日的初始值设定为开始日
    }
};
var end = {
    elem: '#end',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: '1999-06-16 23:59:59',
    max: '2099-06-16 23:59:59',
    istime: true,
    istoday: false,
    choose: function(datas){
        start.max = datas; //结束日选好后，重置开始日的最大日期
    }
};
laydate(start);
laydate(end);
</script>
<script type="text/javascript">
  /////订单搜索
  $(".searOrder").click(function(){
      var $starttime=$("#start").val();
       var $endtime=$("#end").val();
       $.ajax({
        type:'POST',
        url:"{:U('Order/Ordersearch')}",
        data:{"starttime":$starttime,"endtime":$endtime},
        dataType:'JSON',
        success:function(result)
        {
          var statu =result.status;
          var list=result.lists;
          if(statu)
          {
            var $tbody=$('<tbody></tbody>');
              var $string='';
              $.each(list,function(key,order){
                $string+='<tr><td><input type="checkbox"></td>';
                $string+="<td>"+order.order_sn+"</td>";
                $string+="<td>"+order.create_time+"</td>";
                $string+="<td>"+order.pay_type+"</td>";
                $string+="<td>"+order.number+"</td>";
                $string+="<td>"+order.order_amount+"</td>";
                $string+="<td>"+order.itemname+"</td>";
                $string+="<td>"+order.price+"</td>";
            $string+='<td><div class="am-btn-toolbar"><div class="am-btn-group am-btn-group-xs"><button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"><a href="/shop.php/Home/Order/getOrder/orderid/'+order.orderid+'">查看详情</a></span> </button>';
                

              })////遍历数据end
              $tbody.append($string);
              $($tbody).replaceAll(".ordertable tbody");
              $(".orderpage").hide();
          }else
          {
            $('.ordertable tbody').html('暂无数据');
              $('.orderpage').hide();
          }

        }
        
        
       }) ///ajax结束 
     

  })///搜索结束
</script>
</body>
</html>
